home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / WINPROGS / CTL3DPAS.ZIP / SAMPLE3D.PAS < prev    next >
Pascal/Delphi Source File  |  1993-10-04  |  3KB  |  117 lines

  1. (**************************************************)
  2. (*                                                *)
  3. (*   Sample3D - Shows the use of CTL3D.DLL        *)
  4. (*                                                *)
  5. (*   Supplied by Andreas Furrer                   *)
  6. (*                                                *)
  7. (**************************************************)
  8.  
  9. program Sample3D;
  10.  
  11. {$R sample3d.res}
  12.  
  13. uses WinTypes, WinProcs, Objects, OWindows, ODialogs, CommDlg, Ctl3d;
  14. { Use the next line instead of the previous line if you use Turbo Pascal for Windows 1.0 or 1.5 }
  15. { uses WinTypes, WinProcs, WObjects, CommDlg, Ctl3d; }
  16.  
  17. type
  18.    Applikation =
  19.       object(TApplication)
  20.          procedure InitMainWindow; virtual;
  21.       end;
  22.  
  23.    PMainwindow = ^TMainwindow;
  24.    TMainwindow =
  25.       object(TDialog)
  26.          procedure WMDlgBorder(var Msg : TMessage);      virtual wm_DlgBorder;
  27.          procedure WMDlgSubclass(var Msg : TMessage);    virtual wm_DlgSubclass;
  28.          procedure WMSysColorChange(var Msg : TMessage); virtual wm_first + wm_SysColorChange;
  29.          procedure Msgbox(var Msg : TMessage);           virtual id_first + 130;
  30.          procedure Fileopen(var Msg : TMessage);         virtual id_first + 131;
  31.       end;
  32.  
  33.  
  34.  
  35. procedure TMainwindow.WMDlgBorder;
  36. begin
  37. { Remove the comments from the next block of code to      }
  38. { stop the dialog border form being drawn with 3D effects }
  39. {
  40.   PInteger(Msg.lParam)^ := Ctl3d_NoBorder;
  41. }
  42. end;
  43.  
  44. procedure TMainwindow.WMDlgSubclass;
  45. begin
  46. { Remove the comments from the next block of code to      }
  47. { stop subclassing the controls on this dialog            }
  48. {
  49.   PInteger(Msg.lParam)^ := Ctl3d_NoSubclass;
  50. }
  51. end;
  52.  
  53. procedure TMainwindow.WMSysColorChange;
  54. begin
  55.   Ctl3dColorChange;
  56. end;
  57.  
  58. procedure TMainwindow.Msgbox;
  59. begin
  60.   MessageBox(HWindow,'This is a sample Message Box','3D Look',mb_Ok);
  61. end;
  62.  
  63.  
  64. function HookProc(HWindow: HWnd; Msg, wParam: word; lParam: longint): word; far;
  65. var p : TFarProc;
  66. begin
  67.   IF Msg=wm_InitDialog then begin
  68.     Ctl3dSubClassDlg(HWindow,Ctl3d_All);
  69.   end;
  70.   HookProc:=0;
  71. end;
  72.  
  73. procedure TMainwindow.Fileopen;
  74. var FileName : array[0..255] of char;
  75.     Ofn :  TOpenFileName;
  76. begin
  77.   FileName[0]:=#0;
  78.   Ofn.lStructSize       := sizeof(TOpenFileName);
  79.   Ofn.hwndOwner         := HWindow;
  80.   Ofn.hInstance         := HInstance;
  81.   Ofn.lpstrFilter       :='Text Files (*.TXT)'+#0+'*.TXT'+#0+'All Files (*.*)'+#0+'*.*'+#0+#0;
  82.   Ofn.lpstrCustomFilter := nil;
  83.   Ofn.nMaxCustFilter    := 0;
  84.   Ofn.nFilterIndex      := 1;
  85.   Ofn.lpstrFile         := FileName;
  86.   Ofn.nMaxFile          := sizeof(FileName);
  87.   Ofn.lpstrFileTitle    := nil;
  88.   Ofn.nMaxFileTitle     := 0;
  89.   Ofn.lpstrInitialDir   := nil;
  90.   Ofn.lpstrTitle        := '3D Look';
  91.   Ofn.Flags             := ofn_HideReadonly or ofn_EnableHook;
  92.   Ofn.nFileOffset       := 0;
  93.   Ofn.nFileExtension    := 0;
  94.   Ofn.lpstrDefExt       := NIL;
  95.   Ofn.lpTemplateName    := 'FileOpen';
  96.   Ofn.lCustData         := 0;
  97.   Ofn.lpfnHook          := HookProc;
  98.   GetOpenFileName(Ofn);
  99. end;
  100.  
  101. procedure Applikation.InitMainWindow;
  102. begin
  103.   MainWindow := New(PMainwindow, Init(nil, MakeIntResource(100)));
  104. end;
  105.  
  106. var Prg : Applikation;
  107.  
  108. begin
  109.    Ctl3dRegister(HInstance);
  110.    Ctl3dAutoSubclass(HInstance);
  111.  
  112.    Prg.Init('Sample3D');
  113.    Prg.Run;
  114.    Prg.Done;
  115.  
  116.    Ctl3dUnregister(HInstance);
  117. end.